package Practice2;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author d11yu
 */
public class RequestAPIServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("URI: "+ req.getRequestURI());
        System.out.println("URL: " + req.getRequestURL());
        System.out.println("客户端ip: " + req.getRemoteHost());
        System.out.println("user agent: " + req.getHeader("User-Agent"));
        System.out.println("Method: " + req.getMethod());
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
